//
//  LogCatDeviceHelper.m
//  LogCat
//
//  Created by 清风徐来 on 2024/1/8.
//

#import "LogCatDeviceHelper.h"
#import <sys/utsname.h>

@implementation LogCatDeviceHelper

static LogCatDeviceHelper *_sharedInstance;
+ (instancetype)shared {
    if(_sharedInstance == nil) {
        _sharedInstance = [[LogCatDeviceHelper alloc] init];
    }
    return _sharedInstance;
}

+(instancetype)allocWithZone:(struct _NSZone *)zone {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _sharedInstance = [super allocWithZone:zone];
    });
    return _sharedInstance;
}

- (id)copyWithZone:(NSZone *)zone {
    return _sharedInstance;
}

- (id)mutableCopyWithZone:(NSZone *)zone {
    return _sharedInstance;
}


/// 获取手机model
- (NSString *)getDeviceModel {
    struct utsname systemInfo;
    uname(&systemInfo);

    NSString *deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
    return deviceModel;
}

/// 获取设备OSversion
- (NSString *)getDeviceoOsVersion {
    NSString *osVersion = [[UIDevice currentDevice] systemVersion];
    return osVersion;
}

@end
